//@Author: wulinlin
//@Description:
//@File:  CaptchaController
//@Version: 1.0.0
//@Date: 2023/03/09 14:12

package na

import (
	"github.com/gin-gonic/gin"
	"github.com/mojocn/base64Captcha"
	"pingbuqingyun_django/app/services/na"
	"pingbuqingyun_django/pkg/tools"
)

var store = base64Captcha.DefaultMemStore

func CaptchaImgAPI(ctx *gin.Context) {
	temp, err := na.CaptchaSer.MakeCaptcha()
	if err != nil {
		tools.JsonErrorStrResp(ctx, "生成验证码错误")
		return
	}
	// 将验证码扔进redis中保存
	tools.JsonSuccessData(ctx, "验证码生成成功", temp)
	return
}
